#ifndef KPORT_ROUTING_TABLE_CLASS
#define KPORT_ROUTING_TABLE_CLASS

#include <string>
#include <iostream>
#include <string>
#include <map>

#include <netinet/in.h>
#include <netdb.h>
#include <boost/thread/shared_mutex.hpp>
#include <pland.hpp>

namespace kport
{
class RoutingTable
{ 
public:

	typedef std::pair <std::string, struct sockaddr_in* > Route;

    /*! Default Destructor. */
	~RoutingTable();

    /*! Initializer */
	static RoutingTable* loadTable(std::string config_xml) throw(pland::Exeption);
	static RoutingTable* getInstance() ;
	Route route(std::string net) throw(pland::Exeption);
    std::vector <std::string> outGoingNets();
protected:

	RoutingTable();

	RoutingTable(std::string config_xml);

private:
    typedef std::map<std::string, Route > RoutingMap;

	void loadTablePrivate_(std::string config_xml) throw(pland::Exeption);

	static RoutingTable* instance_;

    RoutingMap * map_;
    std::vector <std::string> outGoingNets_;
	boost::shared_mutex access_;

	bool ready_;
};
}
#endif /*routingtable.hpp*/
